package com.yznote.cloudesk.user.controller;

import com.yznote.cloudesk.common.Anno.CollectLogs;
import com.yznote.cloudesk.common.constants.ModuleConstant;
import com.yznote.cloudesk.common.pojo.Personality;
import com.yznote.cloudesk.common.pojo.Result;
import com.yznote.cloudesk.user.server.PersonalityServer;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@Api(tags = "个性化设置")
@RestController
@RequestMapping("/personality")
@CollectLogs(moduleName = ModuleConstant.PERSONALITY_MODULE)
public class PersonalityController {

    @Autowired
    PersonalityServer personalityServer;

    @GetMapping("/getPersonality")
    @ApiOperation("获得用户个性化设置")
    public Result getPersonality() {
        Personality personality = personalityServer.getPersonality();
        return Result.success(personality);
    }

    @PostMapping("/insertPersonality")
    @ApiOperation("新增用户个性化设置")
    public Result insertPersonality(@RequestBody Personality personality) {
        String s = personalityServer.insertPersonality(personality);
        return Result.success(null);
    }

    @PostMapping("/updatePersonality")
    @ApiOperation("更新用户个性化设置")
    public Result updatePersonality(@RequestBody Personality personality) {
        String s = personalityServer.updatePersonality(personality);
        return Result.success(null);
    }

    @ApiOperation("用户上传头像")
    @PostMapping("/pushUserHeaders")
    public Result pushUserHeaders(@RequestParam MultipartFile mtf) throws Exception {
        personalityServer.pushUserHeaders(mtf);
        return Result.success(null);
    }

    @ApiOperation("用户上传背景图")
    @PostMapping("/pushWallpaperPath")
    public Result pushWallpaperPath(@RequestParam MultipartFile mtf) throws Exception {
        personalityServer.pushWallpaperPath(mtf);
        return Result.success(null);
    }

    //@ApiOperation("返回用户最近的三个头像")


}
